package great.project.bean.beandefinition;

import org.springframework.beans.factory.support.AbstractBeanDefinition;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class Main {

    public static void main(String[] args) {

        AnnotationConfigApplicationContext annotationConfigApplicationContext = new AnnotationConfigApplicationContext();

        final AbstractBeanDefinition beanDefinition = BeanDefinitionBuilder
                .genericBeanDefinition()
                .getBeanDefinition();

        beanDefinition.setBeanClass(LiSi.class);
        beanDefinition.setScope("singleton");
        beanDefinition.setLazyInit(false);

        annotationConfigApplicationContext.registerBeanDefinition("liSi", beanDefinition);

        annotationConfigApplicationContext.refresh();

        final LiSi liSi = annotationConfigApplicationContext.getBean("liSi", LiSi.class);

        System.out.println(liSi);

    }

}
